home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-07 | 1.1 KB | 51 lines | [TEXT/CWIE] |
- unit OSSubs;
-
- interface
-
- uses
- Types, OSUtils;
-
- function NumToolboxTraps: integer;
- function GetTrapType (theTrap: Integer): TrapType;
- function OurTrapAvailable (theTrap: integer): boolean;
-
- implementation
-
- uses
- Traps;
-
- function NumToolboxTraps: integer;
- begin
- if NGetTrapAddress(_InitGraf, ToolTrap) = NGetTrapAddress($AA6E, ToolTrap) then begin
- NumToolboxTraps := $200
- end else begin
- NumToolboxTraps := $400;
- end; (* if *)
- end; (* NumToolboxTraps *)
-
- function GetTrapType (theTrap: integer): TrapType;
- const
- TrapMask = $0800;
- begin
- if band(theTrap, TrapMask) > 0 then begin
- GetTrapType := ToolTrap
- end else begin
- GetTrapType := OSTrap;
- end; (* if *)
- end; (* GetTrapType *)
-
- function OurTrapAvailable (theTrap: integer): boolean;
- var
- tType: TrapType;
- begin
- tType := GetTrapType(theTrap);
- if tType = ToolTrap then begin
- theTrap := band(theTrap, $07FF);
- if theTrap >= NumToolboxTraps then begin
- theTrap := _Unimplemented;
- end; (* if *)
- end; (* if *)
- OurTrapAvailable := NGetTrapAddress(theTrap, tType) <> NGetTrapAddress(_Unimplemented, ToolTrap);
- end; (* OurTrapAvailable *)
-
- end. (* OSSubs *)